[#escape x as x?html]
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>合同编辑</title>
[#include "../../include/main.ftl"]
[#include "/include/popdialog.ftl"]
    <script>
        $(function() {
            $("#contractEdit").tabs();
            $("#customerInfo").tabs();
        });
		var rp = function refreshPage(data){
			if (data != null) {
				$('#custSn').val(data.sn);
				$('#name').html(data.name);
				$('#custType').val(data.custType);
				$('#custTypeName').html(data.custTypeName);
				$('#IDCard').html(data.IDCard);
				$('#IDAddress').html(data.IDAddress);
				$('#compAddress').html(data.compAddress);
                $('#custLink').attr("href", "/Ins/customer/edit/" + data.sn);
			}
		};
		function selectUser() {
			popDialog("selectUser", "选择客户",
                        "/Ins/customer/select",
                        rp,600,600);
		}
    </script>
</head>
<body>
<div class="ui-widget page">
[#include '../../top.ftl']

    <div class="content">
    [#include '../../leftNav.ftl']
        <div style="width:845px;height:600px;float: left;padding-left: 5px">
            <div class="ui-widget-content ui-corner-all" style="min-height: 600px;">
                <form name="mainForm" method="post" action="/Ins/contract/save">
                <INPUT TYPE="hidden" NAME="sn" VALUE="${obj.ContractObj.sn?default('')}">
                <INPUT TYPE="hidden" NAME="custSn" id="custSn" VALUE="${obj.ContractObj.custSn?default('')}">
                <INPUT TYPE="hidden" NAME="contractNo" VALUE="${obj.ContractObj.contractNo?default('')}">
                <INPUT TYPE="hidden" NAME="custType" id="custType" VALUE="">
                 <INPUT TYPE="hidden" NAME="createUser" VALUE="${obj.ContractObj.createUser?default('')}">
                  <INPUT TYPE="hidden" NAME="createTime" VALUE="${(obj.ContractObj.createTime?string('yyyy-MM-dd'))?default('')}">
                    【<a href="/Ins/contract/list">返回合同列表</a>】
                    <div id="contractEdit" style="width:830px">

                        <ul style="border-bottom:#aed0ea 1px solid;">
                            <li><a href="#contract_base">基本资料</a></li>

                        </ul>
                        <div id="contract_base">
                            <p>委托书编号:${obj.ContractObj.contractNo!""} <br>
                                签订日期
                                <input type="text" name="contractDate" id="contractDate" onClick="popCalendar(this)" >
                                <script>$("#contractDate").val("${(obj.ContractObj.contractDate?string('yyyy-MM-dd'))?default('')}");</script>
                            </p>

                            <p>【<a href="javaScript:selectUser();">选择客户</a>】</p>

                            <div id="customerInfo" style="width:730px">

                                <ul style="border-bottom:#aed0ea 1px solid;">
                                    <li><a href="#customer_Info">客户资料</a></li>

                                </ul>
                                <div id="customer_Info">
                                  <p>客户名称: <span id="name">${(obj.CustomerObj.name)!''}</span></p>
                                  <p>客户类型: <span id="custTypeName">${(obj.CustomerObj.custTypeName)!''}</span></p>
                                  <p>身份证号: <span id="IDCard">${(obj.CustomerObj.IDCard)!''}</span>                                    </p>
                                  <p>身份证地址:  <span id="IDAddress">${(obj.CustomerObj.IDAddress)!''}</span>                                  </p>
                                  <p>单位地址:  <span id="compAddress">${(obj.CustomerObj.compAddress)!''}</span>                                </p>
                                  <p>【<a href="/Ins/customer/edit/${obj.ContractObj.custSn?default('')}" target="_blank" id="custLink">查看详细信息</a>】</p>
                                </div>
                            </div>

                            <p><span id="spContract"></span> 
                                    <script>
                                    [#list obj.ContractFileList?default([]) as cid]
									$('#spContract').html($('#spContract').html()+getFileLink('${cid.sn}'));
                                [/#list]
								</script>
                                【<a href="javaScript:uploadFile('spContract','合同','${obj.ContractObj.sn?default('')}','原件');">上传委托书原件</a>】</p>
                            <p>
                              <input type="submit" name="button" id="button" value="保存">
                        | <a href="/Ins/contract/del/${obj.ContractObj.sn?default('')}" onClick="return confirm('确定删除?')">删除</a></p>
                        </div>

                    </div>
                </form>
            </div>

        </div>
    </div>

[#include '../../bottom.ftl']
</div>
</body>
</html>
[/#escape]